package com.example.administrator.myproject.user

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView

import com.example.administrator.myproject.R

import cn.bmob.v3.BmobQuery
import cn.bmob.v3.exception.BmobException
import cn.bmob.v3.listener.FindListener
import com.example.administrator.myproject.bean.Collect

/**
 * 评价列表
 */
class AssessList : AppCompatActivity() {

    private var recyclerView: RecyclerView? = null
    private var adapter: AssessAdapter? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.cart_view)
        recyclerView = findViewById(R.id.cart_rv)
        recyclerView!!.layoutManager = LinearLayoutManager(this)
        adapter = AssessAdapter(this)
        recyclerView!!.adapter = adapter
        val query = BmobQuery<Collect>()
        query.addWhereEqualTo("state", "3")
                .order("-createdAt")
                .findObjects(object : FindListener<Collect>() {
                    override fun done(list: List<Collect>, e: BmobException?) {
                        if (e == null) {
                            adapter!!.setData(list)
                        } else {
                        }
                    }
                })
    }
}
